#include <iostream>
using namespace std;

/*
    多重继承父类的构造调用规则
      构造函数调用顺序：多个父类从左到右调用
      析构函数调用顺序：多个父类从右到左调用
*/

class Catamount
{
public:
    Catamount()
    {
        cout << "catamount" << endl;
    }
    Catamount(int age) : age(age)
    {
        cout << "catamount int age" << endl;
    }

private:
    int age;
};

class Mammal
{
public:
    Mammal()
    {
        cout << "mammal" << endl;
    }
    Mammal(float weight) : weight(weight)
    {
        cout << "mammal float weight" << endl;
    }

private:
    float weight;
};

class Cat : public Catamount, public Mammal
{
public:
    Cat() : Catamount(), Mammal()
    {
        cout << "cat" << endl;
    }
    Cat(int age, float weight) : Catamount(age), Mammal(weight) // 全部指定，顺序无所谓
    {
        cout << "cat int age float weight" << endl;
    }
    Cat(int age) : Catamount(age)
    {
        cout << "cat int age" << endl;
    }
    Cat(float weight) : Mammal(weight)
    {
        cout << "cat float weight" << endl;
    }
};

int main()
{
    Cat cat;
    cout << "==========================" << endl;
    Cat cat2(10, 20.0f);
    cout << "==========================" << endl;
    Cat cat3(10);
    cout << "==========================" << endl;
    Cat cat4(20.0f);
    return 0;
}